<?php

declare(strict_types=1);

namespace App\Robot\Job;

use App\Robot\Service\SendRecordMessageHandlerService;
use Carbon\Carbon;
use Hyperf\AsyncQueue\Job;

class SendRecordMsgDelayedTaskJob extends Job
{
    public array $data;

    /**
     * 任务执行失败后的重试次数，即最大执行次数为 $maxAttempts+1 次
     */
    protected int $maxAttempts = 2;


    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public function handle(): void
    {
        try {
            container()->get(SendRecordMessageHandlerService::class)->handle($this->data);
        }catch (\Throwable $e){
            stdout_log()->error('发送异常.'.$e->getMessage());
        }
    }
}